

package com.BeeFramework.activity;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.BeeFramework.model.BeeCallback;
import com.BeeFramework.model.DebugMessageModel;
import com.sgr.dykdriver.R;

public class DebugDetailActivity extends BaseActivity {
	
	private TextView time;
	private TextView message;
	private TextView request;
	private TextView response;
	private TextView netSize;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.debug_message_detail);
		
		Intent intent = getIntent();
		int position = intent.getIntExtra("position", 0);
		
		time = (TextView) findViewById(R.id.debug_detail_time);
		message = (TextView) findViewById(R.id.debug_detail_message);
		request = (TextView) findViewById(R.id.debug_detail_request);
		response = (TextView) findViewById(R.id.debug_detail_response);
		netSize = (TextView) findViewById(R.id.debug_detail_netSize);

        if (position < DebugMessageModel.messageList.size())
        {
            BeeCallback tempCallBack = DebugMessageModel.messageList.get(position);

            String timeDesc = "";
            if (0 != tempCallBack.endTimestamp)
            {
                timeDesc = (tempCallBack.endTimestamp - tempCallBack.startTimestamp)*1.0/1000 +"秒";
            }

            SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日HH时mm分ss秒SSS");

            time.setText("开始时间: " + sdf.format(new Date(tempCallBack.startTimestamp)));
            message.setText(tempCallBack.message);
            request.setText(tempCallBack.requset);
            response.setText(tempCallBack.response);
            netSize.setText(tempCallBack.netSize+ "  \n耗时:" + timeDesc);
        }

		
	}

}
